<?php
class Frame_Block_Toolbar extends block{

    public function init(){
        $user = Monk::getCache('user');
        $team_id = Monk::getCache('team_id');
        $user_teams = Monk::getCache('user_teams');
        /*
        * 全局工具区域
        */
        //应用列表(只有管理员才能看到团队应用并安装应用)
        $model_app = MONK::getSingleton('Frame_Model_App');
        $team_users = array_flip($user_teams);
        if($team_users[$team_id] == $user['user_id']){
            $apps = $model_app->get_apps_by_team_id($team_id);
        }else{
            $apps = $model_app->get_apps_by_user_id($user['user_id']);
        }
        //$user_categorys = $model_app->get_user_category($user['user_id']);
        
        $this->assign('my', $user);
        $this->assign('apps', $apps);
        //$this->assign('user_categorys', $user_categorys);
        return $this->render();
    }

}
